package com.autotest0113;

import org.openqa.selenium.By;
import org.openqa.selenium.chrome.ChromeDriver;

/**
 * @author krystal
 * @date 2023/3/1 9:55
 */
public class FirstAutotest {
    //查询网址搜索关键词边伯贤
    public void baekhyunTest() throws InterruptedException {
        //创建驱动实例，创建会话（打开浏览器
        ChromeDriver driver = new ChromeDriver();
        Thread.sleep(5000);
        //在浏览器输入百度网址，访问百度首页
        driver.get("https://www.baidu.com");
        Thread.sleep(5000);
        //找到百度首页输入框元素，并输入关键词“边伯贤”
        driver.findElement(By.cssSelector("#kw")).sendKeys("边伯贤");
        Thread.sleep(5000);
        //找到百度首页“百度一下“按钮，并点击一下
        driver.findElement(By.cssSelector("#su")).click();
        Thread.sleep(5000);
        //结束会话（关闭浏览器）
        driver.quit();
    }
}
